<!DOCTYPE html>
<html lang="en">
<head>
  <title>键值分析</title>
  <#include '/inc/frontResources.html'>
</head>
<body class="hold-transition sidebar-mini layout-navbar-fixed">
<div class="wrapper">
  <#include '/inc/head.html'>
  <div class="content-wrapper ml-0">
    <div class="content">
      <div class="container-fluid">
        <div class="row">
          <div class="col-12">
            <div class="card">
              <div class="card-header">
                <h4 class="card-title">集群键值分析</h4>
              </div>
              <div class="card-body">
                <div class="row">
                  <div class="col-md-6">
                    <div id="idleKeyDistriContainer"
                         style="max-width: 100%; min-width: 310px; height: 400px; margin: 0 auto"></div>
                  </div>
                  <div class="col-md-6">
                    <div id="keyTtlDistriContainer"
                         style="max-width: 100%; min-width: 310px; height: 400px; margin: 0 auto"></div>
                  </div>
                  <div class="col-md-6">
                    <div id="keyTypeDistriContainer"
                         style="max-width: 100%; min-width: 310px; height: 400px; margin: 0 auto"></div>
                  </div>
                  <div class="col-md-6">
                    <div id="keyValueSizeDistriContainer"
                         style="max-width: 100%; min-width: 310px; height: 400px; margin: 0 auto"></div>
                  </div>
                </div>
              </div>
            </div>

            <div class="card">
              <div class="card-header">
                <h3 class="card-title">
                  键值类型分布
                </h3>
              </div>
              <div class="card-body table-responsive">
                <table class="table table-striped table-hover" style="margin-top: 0px">
                  <thead>
                  <tr>
                    <th scope="col">类型</th>
                    <th scope="col">个数</th>
                  </tr>
                  </thead>
                  <tbody>
                  <#list keyTypeParamCountList as keyTypeParamCount>
                  <tr>
                    <td>${keyTypeParamCount.param!}</td>
                    <td>${keyTypeParamCount.count!}</td>
                  </tr>
                  </#list>
                  </tbody>
                </table>
              </div>
            </div>

            <div class="card">
              <div class="card-header">
                <h3 class="card-title">
                  键值过期分布
                </h3>
              </div>
              <div class="card-body table-responsive">
                <table class="table table-striped table-hover" style="margin-top: 0px">
                  <thead>
                  <tr>
                    <th scope="col">类型</th>
                    <th scope="col">个数</th>
                  </tr>
                  </thead>
                  <tbody>
                  <#list keyTypeParamCountList as keyTypeParamCount>
                  <tr>
                    <td>${keyTypeParamCount.param!}</td>
                    <td>${keyTypeParamCount.count!}</td>
                  </tr>
                  </#list>
                  </tbody>
                </table>
              </div>
            </div>

            <div class="card">
              <div class="card-header">
                <h3 class="card-title">
                  键值空闲分布
                </h3>
              </div>
              <div class="card-body table-responsive">
                <table class="table table-striped table-hover" style="margin-top: 0px">
                  <thead>
                  <tr>
                    <th scope="col">分布</th>
                    <th scope="col">个数</th>
                  </tr>
                  </thead>
                  <tbody>
                  <#list idleKeyParamCountList as idleKeyParamCount>
                  <tr>
                    <td>${idleKeyParamCount.param!}</td>
                    <td>${idleKeyParamCount.count!}</td>
                  </tr>
                  </#list>
                  </tbody>
                </table>
              </div>
            </div>

            <div class="card">
              <div class="card-header">
                <h3 class="card-title">
                  键值值分布
                </h3>
              </div>
              <div class="card-body table-responsive">
                <table class="table table-striped table-hover" style="margin-top: 0px">
                  <thead>
                  <tr>
                    <th scope="col">分布</th>
                    <th scope="col">个数</th>
                  </tr>
                  </thead>
                  <tbody>
                  <#list keyValueSizeParamCountList as keyValueSizeParamCount>
                  <tr>
                    <td>${keyValueSizeParamCount.param!}</td>
                    <td>${keyValueSizeParamCount.count!}</td>
                  </tr>
                  </#list>
                  </tbody>
                </table>
              </div>
            </div>

            <div class="card">
              <div class="card-header">
                <h3 class="card-title">
                  BigKey列表(共${instanceBigKeyCount!0}个)
                </h3>
              </div>
              <div class="card-body table-responsive">
                <table class="table table-striped table-hover" style="margin-top: 0px">
                  <thead>
                  <tr>
                    <th scope="col">实例信息</th>
                    <th scope="col">键名称</th>
                    <th scope="col">类型</th>
                    <th scope="col">长度</th>
                    <th scope="col">创建时间</th>
                  </tr>
                  </thead>
                  <tbody>
                  <#list instanceBigKeyList as instanceBigKey>
                  <tr>
                    <td>${instanceBigKey.ip!}:${instanceBigKey.port!}</td>
                    <td>${instanceBigKey.bigKey!}</td>
                    <td>${instanceBigKey.type!}</td>
                    <td>${instanceBigKey.length!}</td>
                    <td>
                      ${instanceBigKey.createTime?string('yyyy-MM-dd HH:mm:ss')}
                    </td>
                  </tr>
                  </#list>
                  </tbody>
                </table>
              </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
  <#include "/inc/footer.html">
</div>

<script type="text/javascript">
  $(function(){
    var idleKeyStr = ${idleKeyDistri!};
    var idleKeyData = [];
    if(idleKeyStr != null && idleKeyStr != ''){
      idleKeyData = idleKeyStr;
    }
    generateDataPieChart('idleKeyDistriContainer', 'key闲置分布', idleKeyData);
    var keyTtlStr = ${keyTtlDistri!};
    var keyTtlData = [];
    if(keyTtlStr != null && keyTtlStr != ''){
      keyTtlData = keyTtlStr;
    }
    generateDataPieChart('keyTtlDistriContainer', 'key过期分布', keyTtlData);
    var keyTypeStr = ${keyTypeDistri!};
    var keyTypeData = [];
    if(keyTypeStr != null && keyTypeStr != ''){
      keyTypeData = keyTypeStr;
    }
    generateDataPieChart('keyTypeDistriContainer', 'key类型分布', keyTypeData);
    var keyValueSizeStr = ${keyValueSizeDistri!};
    var keyValueSizeData = [];
    if(keyValueSizeStr != null && keyValueSizeStr != ''){
      keyValueSizeData = keyValueSizeStr;
    }
    generateDataPieChart('keyValueSizeDistriContainer', 'key值分布', keyValueSizeData);
  });
</script>
</body>
</html>
